package cn.signalpha.modules.shop.controller.seller;

import cn.signalpha.common.constant.AppConstant;
import cn.signalpha.core.boot.ctrl.BaseController;
import cn.signalpha.core.tool.api.R;
import cn.signalpha.modules.shop.entity.GoodsBrand;
import cn.signalpha.modules.shop.service.GoodsBrandService;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;

/**
 * 控制器
 *
 * @author signalpha
 */
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_SHOP_NAME + "/sys-seller/goods/brand")
@Api(value = "商品品牌", tags = "商品品牌")
public class SpiGoodsBrandController extends BaseController {

	private final GoodsBrandService goodsBrandService;

    @GetMapping("/list")
	@ApiImplicitParams({
		@ApiImplicitParam(name="name", dataType = "string", value = "名称"),
		@ApiImplicitParam(name="status", dataType = "string", value = "状态"),
		@ApiImplicitParam(name="categoryId", dataType = "string", value = "分类id"),
	})
    @ApiOperation(value = "列表", notes = "")
    public R<List<GoodsBrand>> list(@ApiIgnore @RequestParam Map<String, Object> params) {
        return R.data(goodsBrandService.list(goodsBrandService.selectGoodsBrandWrapper(params)));
    }

	@GetMapping("/info")
	@ApiOperation(value = "详情", notes = "传入id")
	public R<GoodsBrand> info(@ApiParam(value = "主键", required = true) @RequestParam Long id) {
		return R.data(goodsBrandService.getById(id));
	}

}
